/* Copyright (c) 2016-2020 Enfry Ltd. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of Enfry. 
 * You shall not disclose such Confidential Information
 * and shall use it only in accordance with the terms of the agreements
 * you entered into with Enfry.
 */
package com.enfry.common.util.constants;

/**
 * 
 * 正则表达式常量定义
 * 
 * @Title com.enfry.util.constants.RegexpConstants
 * @author Penghu
 * @date 2016年11月22日
 */
public interface RegexpConstants {
	/** 需要转义的字符 */
	public static final String ESCAPE = "*.?+$^[](){}|\\/";

	/************************************/
	// 数字相关
	/************************************/

	public static final String NUMERIC = "^\\d+$";// 数字，至少1位
	public static final String NUMERIC_N = "^\\d{n}$";// N位数字
	public static final String NUMERIC_TN = "^\\d{n,}$";// 至少N位数字
	public static final String NUMERIC_N_M = "^\\d{n,m}$";// N-M位数字
	public static final String NUMERICS = "-?[0-9]+(\\.[0-9]+)?";// 数字(正,负数)

	public static final String INTEGER = "^(0|[\\+\\-]?[1-9]\\d*)$";// 整数，支持正负数
	public static final String INTEGER_P = "^[1-9]\\d*$";// 正整数，第一个数字是1-9
	public static final String INTEGER_N = "^\\-[1-9]\\d*$";// 负整数，负号之后第一个数字是1-9
	public static final String INTEGER_N_N = "^(0|[1-9]\\d*)$";// 非负整数，0或者正整数
	public static final String INTEGER_N_P = "^(0|\\-[1-9]\\d*)$";// 非正整数，0或者负整数

	public static final String FLOAT_INT = "^(0|[1-9]\\d*)(\\.\\d+)?$";// 浮点值，支持多位小数
	public static final String FLOAT = "^(0|[\\+\\-]?[1-9]\\d*)(\\.\\d+)?$";// 浮点值，支持多位小数点，支持正负数

	public static final String AMOUNT_INT_2R = "^(0|[1-9]\\d*)(\\.\\d{1,2})?$";// 标准元金额，支持0-2位小数
	public static final String AMOUNT_INT_2R_FIXED = "^(0|[1-9]\\d*)(\\.\\d{2})$";// 固定元金额，两位小数
	public static final String AMOUNT_2R = "^(0|[\\+\\-]?[1-9]\\d*)(\\.\\d{1,2})?$";// 标准元金额，支持0-2位小数，支持正负数
	public static final String AMOUNT_2R_FIXED = "^(0|[\\+\\-]?[1-9]\\d*)(\\.\\d{2})$";// 固定元金额，两位小数，支持正负数

	/************************************/
	// 字符相关
	/************************************/
	public static final String ALPHABAT = "^[A-Za-z]+$";// 字母
	public static final String ALPHABAT_UPPER = "^[A-Z]+$";// 大写字母
	public static final String ALPHABAT_LOWER = "^[a-z]+$";// 小写字母

	public static final String ALPHA_LOWER_NUMERIC = "^[a-z0-9]+$";// 小写字母或数字
	public static final String ALPHA_UPPER_NUMERIC = "^[A-Z0-9]+$";// 大写字母或数字

	public static final String ALPHA_NUMERIC = "^[A-Za-z0-9]+$";// 大写小字母和数字
	public static final String ALPHA_NUMERIC_N_M = "^[A-Za-z0-9]{n,m}$";// 大写小字母和数字
	public static final String ALPHA_NUMERIC_PA = "^[A-Za-z][A-Za-z0-9]*$";// 大写小字母和数字，字母开头
	public static final String ALPHA_NUMERIC_PA_N_M = "^[A-Za-z][A-Za-z0-9]{n,m}$";// 大写小字母和数字，字母开头

	public static final String ALPHA_NUMERIC_UL_PA = "^[A-Za-z_][A-Za-z0-9_]*$";// 大写小字母和数字，字母或下划线开头，java变量和方法命名
	public static final String ALPHA_NUMERIC_UL_DL_PA = "^[A-Za-z_\\$][A-Za-z0-9_\\$]*$";// 大写小字母和数字，字母或下划线或$开头，js变量和方法命名

	public static final String ALPHABAT_DOUBLE = "^[^x00-xff]+$";// 双字节
	public static final String CHINESE = "^[\u4e00-\u9fa5]+$";// 中文
	public static final String CHINESE_ALPHA_NUMERIC = "^[\u4e00-\u9fa5A-Za-z0-9]+$";// 中文大小写字母和数字

	public static final String HEX = "^[A-Fa-f0-9]+$";// 十六进制字符
	public static final String MD5 = "^[A-Fa-f0-9]{32}$";// 32位十六进制字符

	public static final String USER_NAME = "^(?!(_|@|\\.))(?!.*?(_|@|\\.)$)[\\w@\\.\\u4e00-\\u9fa5]{5,25}$";// 账号要求,中文大小写字母和数字和下划线、邮件符、点号，并且不能以@._开头和结尾
	public static final String USER_PASS = "^[\\w@\\.#$]{6,16}$";// 密码要求6-16位的大小写字母和.@_#$符号

	/************************************/
	// 需求表达式
	/************************************/
	public static final String MOBILE = "^((\\+86)|(86)|)?(13[0-9]|14[0-9]|15[0-9]|17[0-9]|18[0-9]|19[0-9]|16[0-9])\\d{8}$";
	public static final String MOBILE_11 = "^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|170|18[0|1|2|3|5|6|7|8|9])\\d{8}$";
	public static final String IP = "^((?:[01]?\\d{1,2}|2[0-4]\\d|25[0-5])\\.){3}(?:[01]?\\d{1,2}|2[0-4]\\d|25[0-5])$";
	public static final String MAC = "^[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}$";
	public static final String QQ = "^[1-9]\\d{4,10}$";
	public static final String POSTAL_CODE = "^[1-9]\\d{5}$";
	public static final String EMAIL = "^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*\\.[a-zA-Z0-9]{2,6}$";

	public static final String DATE = "^(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29)$";
	public static final String TIME = "^([0-1][0-9]|[2][0-3]):([0-5][0-9]):([0-5][0-9])$";
	public static final String DATE_TIME = "^((([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29))\\s(([0-1][0-9]|[2][0-3]):([0-5][0-9]):([0-5][0-9]))$";
	public static final String IDCARD = "^(\\d{6})((((19|20)[0-9]{2})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29))(\\d{3}[0-9xX*])$";

	/************************************/
	// 方法相关
	/************************************/
	public static final String IS_REGEXP = "isRegexp";

	public static final String IS_NUMERIC = "isNumeric";
	public static final String IS_NUMERIC_LEN = "isNumericLen";
	public static final String IS_INTEGER = "isInteger";
	public static final String IS_INTEGER_VALUE = "isIntegerValue";

	public static final String IS_ALPHA_NUMERIC = "isAlphaNumeric";
	public static final String IS_ALPHA_NUMERIC_LEN = "isAlphaNumericLen";
	public static final String IS_ALPHA_NUMERIC_LEN_PA = "isAlphaNumericLenPA";

	public static final String IS_FLOAT = "isFloat";
	public static final String IS_AMOUNT_2R = "isAmount2R";
	public static final String IS_EMAIL = "isEmail";
	public static final String IS_POSTAL_CODE = "isPostalCode";
	public static final String IS_IP = "isIP";
	public static final String IS_MAC = "isMacAddress";

	public static final String IS_MOBILE = "isMsisdn";
	public static final String IS_MOBILE11 = "isMsisdn11";
	public static final String IS_DATE = "isDate";
	public static final String IS_TIME = "isTime";
	public static final String IS_DATE_TIME = "isDateTime";
	public static final String IS_IDCARD = "isIdcard";

	// 非正则表达式
	public static final String IS_EMPTY = "isEmpty";
	public static final String IS_NOT_EMPTY = "isNotEmpty";
	public static final String IS_EQUAL = "isEqual";
	public static final String IS_SCOPE = "isScope";

	public static final String IS_SELECT = "isSelect";
	public static final String IS_CHECKED = "isChecked";

	public static final String IS_LEN = "isLen";
	public static final String IS_BYTE_LEN = "isByteLen";
	public static final String IS_LESS_THEN = "isLessThen";
	public static final String IS_LESS_THEN_VALUE = "isLessThenValue";
	public static final String IS_LESS_EQUAL_THEN = "isLessEqualThen";
	public static final String IS_LESS_EQUAL_THEN_VALUE = "isLessEqualThenValue";
	public static final String IS_GREATER_THEN = "isGreaterThen";
	public static final String IS_GREATER_THEN_VALUE = "isGreaterThenValue";
	public static final String IS_GREATER_EQUAL_THEN = "isGreaterEqualThen";
	public static final String IS_GREATER_EQUAL_THEN_VALUE = "isGreaterEqualThenValue";
}
